Duplicated Code in Conditional Branches (DCCB)

Description:

DCCB detects conditional statements where both branches have the same code. Such code should be moved outside of the conditional branches.

Incorrect:

if index + delta > limit then
begin
    index := limit;
    v[index] := val;
end
else
begin
    index := index + delta;
    v[index] := val;
end;

Correct:

if index + delta > limit then
    index := limit
else
    index := index + delta;
v[index] := val;

Refactoring: